From: David Härdeman Date: Mon, 1 Dec 2025 07:37:32 +0000 (+0100) Subject: dhcpv6-ia: fix crash in dhcpv6_free_lease() X-Git-Url: http://git.openwrt.org/%22https:/collectd.org///%22https:/collectd.org/?a=commitdiff_plain;h=94ef124f726e216648670c6319fd227fdb2691dd;p=project%2Fodhcpd.git dhcpv6-ia: fix crash in dhcpv6_free_lease() Note that dhcpv6_free_lease() can be called with a NULL argument e.g. from dhcpv6_ia_handle_IAs() when iface->no_dynamic_dhcp is set and a client without a static lease cfg tries to get a dynamic lease. Closes: #321 Signed-off-by: David Härdeman Link: https://github.com/openwrt/odhcpd/pull/335 Signed-off-by: Álvaro Fernández Rojas --- diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c index f227ad6..5af952d 100644 --- a/src/dhcpv6-ia.c +++ b/src/dhcpv6-ia.c @@ -60,6 +60,9 @@ dhcpv6_alloc_lease(size_t extra_len) void dhcpv6_free_lease(struct dhcpv6_lease *a) { + if (!a) + return; + list_del(&a->head); list_del(&a->lease_cfg_list);